package lib.bone.flow.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * @author: kindear
 * 流程任务实体信息表
 */
@Data
@Entity
@Table(name = "flow_task")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
@EntityListeners(AuditingEntityListener.class)
public class FlowTask {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @ApiModelProperty(value = "流程任务ID",name = "id")
    String id;

    /**
     * 流程实例ID
     */
    @ApiModelProperty("流程实例ID")
    @Column(name = "flow_work_id")
    String flowWorkId;

    /**
     * 流程节点ID
     */
    @ApiModelProperty("流程节点ID")
    @Column(name = "flow_node_id")
    String flowNodeId;

    /**
     * 流程参数
     */
    @ApiModelProperty(value = "流程参数",name = "")
    @Column(name = "flow_param",length = 5112)
    String flowParam;

    /**
     * 任务名称
     */
    @ApiModelProperty("任务名称")
    @Column(name = "task_name")
    String taskName;

    /**
     * 操作者用户ID
     */
    @ApiModelProperty("操作者ID")
    @Column(name = "operator")
    String operator;

    /**
     * 执行用户ID
     */
    @ApiModelProperty("执行者ID")
    @Column(name = "act_user_id")
    String actUserId;

    @ApiModelProperty("流程发起者ID")
    @Column(name = "initiator")
    String initiator;

    /**
     * 任务状态
     */
    @ApiModelProperty(value = "任务状态",name = "新建CREATED->已完成FINISHED->过期EXPIRED->取消CANCEL->驳回REJECT")
    @Column(name = "task_status")
    String taskStatus;


    /**
     * 业务类型
     */
    @ApiModelProperty("业务类型")
    @Column(name = "service_type")
    String serviceType;

    /**
     * 关联的业务ID
     */
    @ApiModelProperty("业务ID")
    @Column(name = "service_id")
    String serviceId;


    @ApiModelProperty("业务名称")
    @Column(name = "service_name")
    String serviceName;

    /**
     * 完成时间
     */
    @ApiModelProperty("完成时间")
    @Column(name = "finish_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    Date finishTime;

    /**
     * 任务状态
     */
    @ApiModelProperty(value = "任务状态",name = "0被关闭1正常")
    @Column(name = "status")
    Integer status;
    @CreatedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录创建时间",name = "createdTime")
    @Column(name = "created_time")
    private Date createdTime;
    @LastModifiedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录更新时间",name = "updatedTime")
    @Column(name = "updated_time")
    private Date updatedTime;

}
